From 7c2d21892fca112cbb4c1744460adff5f3661571 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 20 Jun 2020 12:08:46 -0400 Subject: [PATCH] gridview: Compute right amount of items to skip We only want to skip the remaining items in the current row, not since the start of the widget. --- gtk/gtkgridview.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/gtkgridview.c b/gtk/gtkgridview.c index 5531b5c53c..b9c2c9a87c 100644 --- a/gtk/gtkgridview.c +++ b/gtk/gtkgridview.c @@ -269,7 +269,8 @@ gtk_grid_view_get_cell_at_y (GtkGridView *self, /* skip remaining items at end of row */ if (pos % self->n_columns) { - skip = pos - pos % self->n_columns; + skip = self->n_columns - pos % self->n_columns; + g_assert (n_items > skip); n_items -= skip; pos += skip; } -- 2.30.2